package DAO;

import Factory.ConnectionFactory;
import Modelo.LoginBean;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class LoginDAO {

    private Connection conn;

    public LoginDAO() throws Exception{
        this.conn = ConnectionFactory.getConnection();
    }

    public void insert(LoginBean lb){
        
    }

    public void update(LoginBean lb){
        
    }

    public void delete(LoginBean lb){
        
    }

    public boolean ValidarLogin(String user, String pass) throws SQLException{
        
        Statement stmt = conn.createStatement();
        
        ResultSet rs = stmt.executeQuery("select senha from usuario where usuario = '" + user + "'");
        
        if (rs.next()){
            if (rs.getString("senha").compareTo(pass) == 0) {
                return true;
            }
        }
        
        return false;
    }

}
